package cn.codexin.wechatofficial.controller;

import cn.codexin.wechatofficial.model.dbo.AlarmLocation;
import cn.codexin.wechatofficial.service.WarnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.HashSet;

/**
 * Created by xinGao 2020/4/22
 * 用来测试
 */

@RestController
@RequestMapping(value = "test", produces = "application/json;charset=UTF-8")
public class IndexController {

    @Autowired
    private WarnService warnService;

    @GetMapping("alarmLocation")
    public String index() {
        String writePath="test.txt";
        File writeFile = new File(writePath);
        String readPath="test.txt";
        File readFile = new File(readPath);
        HashSet<Integer> writeSet=new HashSet<>();
        writeSet.add(12);
        writeSet.add(45);
        writeSet.add(128);
        writeSet.add(1);
        warnService.writeFile(writeSet,writeFile);
        HashSet<Integer> readSet = warnService.readFile(readFile);
        readFile.delete();
        return readSet.toString();
    }
}
